from datetime import datetime
from typing import Optional
from pydantic import BaseModel, UUID4, Field
from app.schemas.archivable import Archivable

# 基础模型
class BroadcastPresetsBase(BaseModel):
    title: Optional[str] = Field(description="播报文案预设标题")
    category_name: Optional[str] = Field(description="播报文案预设分类")
    content: Optional[str] = Field(description="内容")

# 创建模型
class BroadcastPresetsCreate(BroadcastPresetsBase):
    title: str
    category_name: str
    content: str

# 更新模型
class BroadcastPresetsUpdate(BroadcastPresetsBase):
    pass

# 数据库基础模型
class BroadcastPresetsInDBBase(BroadcastPresetsBase, Archivable):
    id: UUID4
    created_at: datetime
    updated_at: Optional[datetime] = None
    archived_at: Optional[datetime] = None

    # class Config:
    #     from_attributes = True
    #     protected_namespaces = ()
        # allow_population_by_field_name = True
# 返回模型
class BroadcastPresets(BroadcastPresetsInDBBase):
    pass

# 数据库模型
class BroadcastPresetsInDB(BroadcastPresetsInDBBase):
    user_id: Optional[UUID4]
